Skip to content

[streams] populate added stream with codec param (fixes #1044) - #1062

Merged
jlaine merged 1 commit into
PyAV-Org:mainfrom
HanzCEO:main
Jan 31, 2023
Merged

jlaine merged 1 commit into
PyAV-Org:mainfrom
HanzCEO:main

Conversation

@HanzCEO

@HanzCEO HanzCEO commented Dec 25, 2022

Copy link
Copy Markdown
Contributor

fixes #1044

avformat_new_stream(AVFormatContext *s, const AVCodec *c) does not use their second parameter [1]
So avcodec_parameters_from_context() should do the job [2]

@hmaarrfk hmaarrfk mentioned this pull request Jan 9, 2023
4 of 6 tasks
@jlaine

jlaine commented Jan 21, 2023

Copy link
Copy Markdown
Member

This looks interesting, but it absolutely needs some tests. Since you seem to have identified the conditions under which this occurs this should be easy for you.

@hmaarrfk

Copy link
Copy Markdown
Contributor

This fixes an issue I observed. Feel free to pull the tests from #1068 you'll need to update a small check. but it fixes my segfault.

avformat_new_stream(AVFormatContext *s, const AVCodec *c) does not use its
second parameter [1], so the codec type for the stream is not populated until
avcodec_parameters_from_context() [2] is called.

[1]: https://ffmpeg.org/doxygen/trunk/group__lavf__core.html#gadcb0fd3e507d9b58fe78f61f8ad39827
[2]: https://ffmpeg.org/doxygen/trunk/codec__par_8c_source.html#l00099

Co-authored-by: Jeremy Lainé <jeremy.laine@m4x.org>
@jlaine

jlaine commented Jan 30, 2023

Copy link
Copy Markdown
Member

Some comments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[av v10.0] The output container does not put audio stream under audio but under other instead

3 participants